package com.pubinfo.passbook.common.enums;

import com.pubinfo.passbook.common.exception.ServiceException;
import com.pubinfo.passbook.common.model.vo.base.BusinessErrorCode;
import lombok.Getter;

/**
 * 合同状态枚举
 */
@Getter
public enum ContractApplyStatusEnum {

    APPLIED(0, "已申请"),
    HAVE_INVOICE(10, "已开发票"),
    ;

    private Integer status;

    private String desc;

    ContractApplyStatusEnum(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static ContractApplyStatusEnum getEnum(Integer status) {
        for (ContractApplyStatusEnum e : ContractApplyStatusEnum.values()) {
            if (status == e.getStatus()) {
                return e;
            }
        }
        throw new ServiceException(BusinessErrorCode.STATUS_NOT_EXIST);
    }

}
